import Vue from "vue";
import VueRouter from "vue-router";


Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "login",
    component: () => import( '../views/login')
  },
  {
		path: '/manage',
		component: () => import( '../views/manage'),
		name: '',
		children: [{
			path: '',
			component: () => import( '../views/home'),
      meta:{
        title:['首页'],
      }
    },{
			path: '/401',
			component:  () => import( '../views/error/401'),
      meta:{
        title:['错误页面','401'],
        nav:{
          text:'401',
          path:"/401"
        }
      }
    },{
			path: '/404',
			component:  () => import( '../views/error/404'),
      meta:{
        title:['错误页面','404'],
        nav:{
          text:'404',
          path:"/404"
        }
      }
    },{
			path: '/userlist',
			component:  () => import( '../views/list/UserList'),
      meta:{
        title:['设置','管理员','账户列表'],
        nav:{
          text:'账户列表',
          path:"/userlist"
        }
      }
    },{
			path: '/adduser',
			component: () => import( '../views/add/AddUser'),
      meta:{
        title:['添加数据','添加食品'],
        nav:{
          text:'添加食品',
          path:"/adduser"
        }
      }
    },{
			path: '/userdata',
			component: () => import( '../views/UserData'),
      meta:{
        title:['图表','用户分布'],
        nav:{
          text:'用户分布',
          path:"/userdata"
        }
      }
    },{
			path: '/refresh',
			component: () => import( '../views/refresh'),
      meta:{
        title:['  '],
      }
    },{
			path: '/jurisdiction',
			component: () => import( '../views/add/AddUserJurisdiction'),
      meta:{
        title:['设置','权限设置'],
        nav:{
          text:'权限设置',
          path:"/jurisdiction"
        }
      }
    },{
			path: '/personalrights',
      component: () => import( '../views/PersonalRights'),
      meta:{
        title:["数据管理",'用户列表','权限编辑'],
        nav:{
          text:'/',//判断是否需要展示文字
          path:""
        },
        back:true
      }
    },{
			path: '/richtext',
      component:  () => import( '../views/RichText'),
      meta:{
        title:['编辑','富文本编辑'],
        nav:{
          text:'富文本编辑',
          path:"/richtext"
        }
      }
    },{
			path: '/rolelist',
      component:  () => import( '../views/list/RoleList'),
      meta:{
        title:['设置','管理员','角色列表'],
        nav:{
          text:'角色列表',
          path:"/rolelist"
        }
      }
    },{
			path: '/addrole',
      component:  () => import( '../views/add/AddRole'),
      meta:{
        title:['添加数据','添加角色'],
        nav:{
          text:'添加角色',
          path:"/addrole"
        }
      }
    },{
			path: '/menulist',
      component:() => import( '../views/list/MenuList'),
      meta:{
        title:['设置','菜单管理','菜单列表'],
        nav:{
          text:'菜单列表',
          path:"/menulist"
        }
      }
    },{
			path: '/addmenu',
      component: () => import( '../views/add/AddMenu'),
      meta:{
        title:['添加数据','添加顶级菜单'],
        nav:{
          text:'添加顶级菜单',
          path:"/addmenu"
        }
      }
    },{
			path: '/redactset',
			component:  () => import( '../views/redact/RedactSet'),
      meta:{
        title:['设置','编辑设置'],
        nav:{
          text:'编辑设置',
          path:"/redactset"
        }
      }
    },
    {
			path: '/announcementlist',
			component:  () => import( '../views/announcement/AnnouncementList'),
      meta:{
        title:['公告管理','公告列表'],
        nav:{
          text:'公告列表',
          path:"/announcementlist"
        }
      }
    },{
			path: '/announcementlistAddList',
			component:  () => import( '../views/announcement/AddList'),
      meta:{
        title:['公告管理','添加公告列表'],
        nav:{
          text:'添加公告列表',
          path:"/announcementlistAddList"
        },
        back:true
      }
    },
    {
			path: '/orderlist',
			component:  () => import( '../views/order/OrderList'),
      meta:{
        title:['订单','订单列表'],
        nav:{
          text:'订单列表',
          path:"/orderlist"
        },
      }
    },
    {
			path: '/slidelist',
			component:  () => import( '../views/slide/SlideList'),
      meta:{
        title:['幻灯片管理','幻灯片列表'],
        nav:{
          text:'幻灯片列表',
          path:"/slidelist"
        },
      }
    },
    {
			path: '/slidelistAddList',
			component:  () => import( '../views/slide/AddList'),
      meta:{
        title:['幻灯片管理','添加幻灯片列表'],
        nav:{
          text:'添加幻灯片列表',
          path:"/slidelistAddList"
        },
        back:true
      }
    },
    {
			path: '/auditlist',
			component:  () => import( '../views/audit/AuditList'),
      meta:{
        title:['审核','审核列表'],
        nav:{
          text:'审核列表',
          path:"/auditlist"
        },
      }
    },
    {
			path: '/viplist',
			component:  () => import( '../views/Vip/VipList'),
      meta:{
        title:['会员','会员列表'],
        nav:{
          text:'会员列表',
          path:"/viplist"
        },
      }
    },
    {
			path: '/articlelist',
			component:  () => import( '../views/articlelist/classify/ArticleList'),
      meta:{
        title:['文章管理','文章分类列表'],
        nav:{
          text:'文章分类列表',
          path:"/articlelist"
        },
      }
    },
    {
			path: '/addarticle',
			component:  () => import( '../views/articlelist/classify/AddArticlelist'),
      meta:{
        title:['文章管理','添加分类文章'],
        nav:{
          text:'添加分类文章',
          path:"/addarticle"
        },
      }
    },
    {
			path: '/essaylist',
			component:  () => import( '../views/articlelist/essay/EssayList'),
      meta:{
        title:['文章管理','文章列表'],
        nav:{
          text:'文章列表',
          path:"/essaylist"
        },
      }
    },
    {
			path: '/addessay',
			component:  () => import( '../views/articlelist/essay/AddEssay'),
      meta:{
        title:['文章管理','添加文章'],
        nav:{
          text:'添加文章',
          path:"/addessay"
        },
      }
    },
    {
			path: '/courseclassifylist',
			component:  () => import( '../views/course/courseclassify/CourseClassifyList'),
      meta:{
        title:['直播间课程管理','课程分类'],
        nav:{
          text:'课程分类',
          path:"/courseclassifylist"
        },
      }
    },
    {
			path: '/addcourseclassify',
			component:  () => import( '../views/course/courseclassify/AddCourseClassify'),
      meta:{
        title:['直播间课程管理','添加课程分类'],
        nav:{
          text:'添加课程分类',
          path:"/addcourseclassify"
        },
      }
    },
    {
			path: '/SubordinateList',
			component:  () => import( '../views/course/courseclassify/SubordinateList'),
      meta:{
        title:['直播间课程管理','二级课程分类'],
        nav:{
          text:'二级课程分类',
          path:"/SubordinateList"
        },
      }
    },
    {
			path: '/CourseList',
			component:  () => import( '../views/course/courseclassify/CourseList'),
      meta:{
        title:['直播间课程管理','分类下的课程列表'],
        nav:{
          text:'分类下的课程列表',
          path:"/CourseList"
        },
      }
    },
    {
			path: '/course_list',
			component:  () => import( '../views/course/course/CourseList'),
      meta:{
        title:['课程管理','课程列表'],
        nav:{
          text:'课程列表',
          path:"/course_list"
        },
      }
    },
    {
			path: '/course_add',
			component:  () => import( '../views/course/course/Addcourse'),
      meta:{
        title:['课程管理','添加课程列表'],
        nav:{
          text:'添加课程列表',
          path:"/course_add"
        },
      }
    },
    {
			path: '/CompileCourse',
			component:  () => import( '../views/course/course/CompileCourse'),
      meta:{
        title:['课程管理','编辑课程'],
        nav:{
          text:'编辑课程',
          path:"/CompileCourse"
        },
      }
    },
    {
			path: '/livelist',
			component:  () => import( '../views/course/course/LiveList'),
      meta:{
        title:['课程管理','对应下的直播间列表'],
        nav:{
          text:'对应下的直播间列表',
          path:"/livelist"
        },
      }
    },
    {
			path: '/live_list',
			component:  () => import( '../views/course/live/LiveList'),
      meta:{
        title:['直播间管理','直播间列表'],
        nav:{
          text:'直播间列表',
          path:"/live_list"
        },
      }
    },
    {
			path: '/Compilelive',
			component:  () => import( '../views/course/live/CompileLive'),
      meta:{
        title:['直播间管理','直播间列表详情'],
        nav:{
          text:'直播间列表详情',
          path:"/Compilelive"
        },
      }
    },
    {
			path: '/addlive',
			component:  () => import( '../views/course/live/LiveAdd'),
      meta:{
        title:['直播间管理','添加直播间'],
        nav:{
          text:'添加直播间',
          path:"/addlive"
        },
      }
    },
    {
			path: '/videolist',
			component:  () => import( '../views/video/VideoList'),
      meta:{
        title:['视频管理','视频列表'],
        nav:{
          text:'视频列表',
          path:"/videolist"
        },
      }
    },
    {
			path: '/vlist',
			component:  () => import( '../views/Vip/VList'),
      meta:{
        title:['会员管理','该会员对应列表'],
        nav:{
          text:'查看会员对应列表',
          path:"/vlist"
        },
      }
    }
  ]
  }
];

const router = new VueRouter({
  mode: "hash",
  base: process.env.BASE_URL,
  routes
});

// 重写路由push 解决跳转同一个路由时报错问题
// -----------------------------
const routerPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    return routerPush.call(this, location).catch(error => error)
}


export default router;
